package model.commands.environment;

import java.util.List;
import model.Environment;
import model.SyntaxErrorException;
import model.commands.Command;

/**
 * Name:
 * SETPENCOLOR color_index
 * SETPC color_index
 * 
 * Description:
 * sets color of the pen to that represented by color_index
 * returns given color index
 *
 * @author Angelica Schwartz
 */
public class SetPenColorCommand extends Command {
    
    @Override
    public int evaluate (Environment e) throws SyntaxErrorException {
        List<Command> arguments = getArguments();
        int colorIndex = arguments.get(0).evaluate(e);
        e.invokeCommandableMethod(Environment.SET_PEN_COLOR, e.getColor(colorIndex));
        return colorIndex;
    }

}
